//
//  UserInfoTwoTableViewCell.m
//  AAIM
//
//  Created by 远的小布丁 on 2019/11/27.
//  Copyright © 2019 AAIM. All rights reserved.
//

#import "UserInfoTwoTableViewCell.h"

@implementation UserInfoTwoTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(void)setShowUI{
    
    
    [self addSubview:self.titleLabel];
    [self addSubview:self.rightImageView];
    [self addSubview:self.nameLabel];
    [self addSubview:self.codeImageView];
    
    [_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.mas_left).offset(SCALAE_WIDTH(15));
//        make.top.equalTo(self.mas_top).offset(SCALAE_WIDTH(15));
        make.centerY.equalTo(self.mas_centerY);
        make.width.offset(SCALAE_WIDTH(86));
    }];
    [_rightImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(self.mas_right).offset(SCALAE_WIDTH(-15));
        make.size.mas_equalTo(CGSizeMake(SCALAE_WIDTH(5), SCALAE_WIDTH(12)));
    }];

    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.titleLabel.mas_right).offset(SCALAE_WIDTH(10));
        make.right.equalTo(self.mas_right).offset(SCALAE_WIDTH(-32));
        make.centerY.equalTo(self.mas_centerY);
    }];

    [_codeImageView mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.equalTo(self.titleLabel.mas_top);
        make.centerY.equalTo(self.rightImageView.mas_centerY);
        make.right.equalTo(self.mas_right).offset(SCALAE_WIDTH(-32));
        make.size.mas_equalTo(CGSizeMake(SCALAE_WIDTH(21), SCALAE_WIDTH(21)));
    }];

}

-(void)setStr:(NSString *)str{
    _titleLabel.text = str;
//    NSLog(@"%d",_isShow);
    if (self.isShow) {
        
        _codeImageView.hidden = YES;
        _nameLabel.hidden = NO;
    }else{
        _codeImageView.hidden = NO;
        _nameLabel.hidden = YES;
    }
}

- (void)setIsShow:(BOOL)isShow{
    _isShow = isShow;
    
}

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]init];
        _titleLabel.textColor = KHEXCOLOR(@"#262B2F");
        _titleLabel.font = kMainFont(14);
    }
    return _titleLabel;
}

- (UILabel *)nameLabel{
    if (!_nameLabel) {
        _nameLabel = [[UILabel alloc]init];
        _nameLabel.textColor = KHEXCOLOR(@"#AFAFAF");
        _nameLabel.font = kMainFont(14);
        _nameLabel.textAlignment = NSTextAlignmentRight;
    }
    return _nameLabel;
}

- (UIImageView *)rightImageView{
    if (!_rightImageView) {
        _rightImageView = [[UIImageView alloc]init];
        _rightImageView.image = [UIImage imageNamed:@"我的-返回键头"];
    }
    return _rightImageView;
}

- (UIImageView *)codeImageView{
    if (!_codeImageView) {
        _codeImageView = [[UIImageView alloc]init];
        _codeImageView.image = [UIImage imageNamed:@"erweima"];
    }
    return _codeImageView;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
